home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 5.7 KB | 251 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWStdDef.h
- // Release Version: $ 1.0d11 $
- //
- // Copyright: (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWSTDDEF_H
- #define FWSTDDEF_H
-
- #ifndef FWENVDEF_H
- #include "FWEnvDef.h"
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__TYPES__)
- #include <Types.h>
- #endif
-
- #if defined(FW_BUILD_MAC) & !defined(__LOWMEM__)
- #include <LowMem.h>
- #endif
-
- #if defined FW_BUILD_MAC && !defined __FILES__
- #include <Files.h>
- #endif
-
- #ifdef FW_BUILD_WIN
- #include <windows.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*========================================================================================
- / Macro definitions
- /
- / The macros FW_SHARED_MEMBER and FW_SHARED_GLOBAL should only be used for placement.
- / ODF is built with model large, so pointers are always far by default. However,
- / static data in DLLs must still have the __far keyword in order to be accessible across DLLs.
- /========================================================================================*/
-
- #ifdef FW_BUILD_MAC
- #define FW_SHARED_MEMBER
- #define FW_SHARED_GLOBAL
- #endif
-
- #ifdef FW_BUILD_WIN
-
- #ifdef FW_BUILD_WIN32
- // [KVV] Microsoft C++ 2.0 produces a compile error when a member of
- // an exported class is itself exported. So we nee to differentiate between
- // shared member and shared global
- #define FW_SHARED_MEMBER
- #define FW_SHARED_GLOBAL __declspec(dllexport)
- #endif
-
- #ifdef FW_BUILD_WIN16
- #define FW_SHARED_MEMBER __export __far
- #define FW_SHARED_GLOBAL __export __far
- #endif
-
- #endif
-
- #ifdef FW_BUILD_MAC
- #define FW_CLASS_ATTR
- #define FW_FUNC_ATTR
- #endif
-
- #ifdef FW_BUILD_WIN32
-
- #ifdef __SC__
- #define FW_CLASS_ATTR // __export
- #define FW_FUNC_ATTR // __export
- #else
- #define FW_CLASS_ATTR // __declspec(dllexport)
- #define FW_FUNC_ATTR // __declspec(dllexport)
- #endif
-
- #endif
-
- #ifdef FW_BUILD_WIN16
- #define FW_CLASS_ATTR __export
- #define FW_FUNC_ATTR __export
- #endif
-
- #ifndef SOMCHKEXCEPT
- #define SOMCHKEXCEPT You_forgot_to_include_FWODExce_has_the_first_header_in your__cpp
- #endif
-
- /*========================================================================================
- // Define OpenDoc version number so we can use appropriate interface
- /========================================================================================*/
-
- #ifndef FW_OPENDOC_VERSION
-
- #define FW_OPENDOC_DR1 1
- #define FW_OPENDOC_DR2 2
- #define FW_OPENDOC_DR3 3
- #define FW_OPENDOC_DR4 4
- #define FW_OPENDOC_100 5
-
- #ifdef FW_BUILD_MAC
- #define FW_OPENDOC_VERSION FW_OPENDOC_DR4
- #endif
-
- #ifdef FW_BUILD_WIN
- #define FW_OPENDOC_VERSION FW_OPENDOC_DR2
- #endif
-
- #endif
-
- /*========================================================================================
- / Type definitions
- /========================================================================================*/
-
- typedef unsigned char FW_Boolean;
-
- typedef unsigned short FW_ResourceId;
-
- typedef unsigned short FW_Milliseconds;
-
- typedef unsigned long FW_TypeToken;
-
- // ----- Macintosh -----
- #ifdef FW_BUILD_MAC
-
- typedef char** FW_PlatformHandle;
-
- typedef unsigned long FW_ResourceType;
-
- typedef FSSpec* FW_Instance;
-
- typedef double_t FW_Double;
-
- typedef Rect FW_PlatformRect;
- typedef Point FW_PlatformPoint;
- typedef short FW_PlatformCoordinate;
-
- #endif
-
-
- // ----- Windows -----
- #ifdef FW_BUILD_WIN
-
- typedef HANDLE FW_PlatformHandle;
-
- typedef unsigned short FW_ResourceType;
-
- typedef HINSTANCE FW_Instance;
-
- typedef RECT FW_PlatformRect;
- typedef POINT FW_PlatformPoint;
-
- typedef long double FW_Double;
-
- #ifdef FW_BUILD_WIN32
- typedef long FW_PlatformCoordinate;
- #endif
- #ifdef FW_BUILD_WIN16
- typedef int FW_PlatformCoordinate;
- #endif
-
- #endif
-
- /*========================================================================================
- / Mac A5 Globals
- /========================================================================================*/
-
- #ifdef FW_BUILD_MAC
-
- #pragma options align=mac68k
- typedef struct
- {
- char privates[76];
- long randSeed;
- BitMap screenBits;
- Cursor arrow;
- Pattern dkGray;
- Pattern ltGray;
- Pattern gray;
- Pattern black;
- Pattern white;
- GrafPtr thePort;
- } FW_QDGlobalRec;
-
- #define FW_QDGlobals (*(FW_QDGlobalRec*)( *(char**)LMGetCurrentA5() \
- - sizeof(FW_QDGlobalRec) + sizeof(GrafPtr)))
-
- #pragma options align=reset
- #endif
-
- /*========================================================================================
- / Constants
- /========================================================================================*/
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #ifndef TRUE
- #define TRUE 1
- #endif
-
- /*========================================================================================
- / Macros
- /========================================================================================*/
-
- #define FW_UNUSED(x) ((void) &x)
-
- #ifdef __cplusplus
- }
- #endif
-
- //========================================================================================
- // Minimum and maximum functions
- //========================================================================================
-
- #define FW_PRIV_DEFINE_MIN_MAX(t) \
- inline t FW_Minimum(t a, t b) \
- { return a < b ? a : b; } \
- inline t FW_Maximum(t a, t b) \
- { return a > b ? a : b; }
-
- #define FW_PRIV_DEFINE_ABS(t) \
- inline t FW_Absolute(t a) \
- { return a > 0 ? a : -a; }
-
- FW_PRIV_DEFINE_MIN_MAX(short)
- FW_PRIV_DEFINE_ABS(short)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned short)
-
- FW_PRIV_DEFINE_MIN_MAX(int)
- FW_PRIV_DEFINE_ABS(int)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned int)
-
- FW_PRIV_DEFINE_MIN_MAX(long)
- FW_PRIV_DEFINE_ABS(long)
-
- FW_PRIV_DEFINE_MIN_MAX(unsigned long)
-
- #endif
-